package com.qyhl.module_home.city;


import com.qyhl.webtv.commonlib.entity.home.CityBean;

/**
 * Created by qyhl on 2017/11/24.
 */

public class CityPresenter implements CityContract.CityPresenter {
    private CityFragment mView;
    private CityModel mModel;

    public CityPresenter(CityFragment mView) {
        this.mView = mView;
        this.mModel = new CityModel(this);
    }

    @Override
    public void setData(CityBean bean) {
        mView.setData(bean);
    }

    @Override
    public void setError(int code, String msg) {
        if (code == 0) {
            mView.setNetError(msg);
        } else if (code == 1) {
            mView.setEmpty(msg);
        } else {
            mView.setError(msg);
        }
    }

    @Override
    public void getData() {
        mModel.getData();
    }
}
